layui.use(['jquery', 'layer', 'table', 'form', 'upload'], function () {
        $ = layui.jquery,
            layer = layui.layer,
            form = layui.form,
            upload = layui.upload,
            table = layui.table;


        //获取用户优惠券使用记录表
        $.ajax({
                url:'/CouponUsed/getTable',
                methos:'post',
                dataType:'json',
                success:function (data) {
                        tab(data);
                }
        })

        function tab(data) {
                table.render({
                        elem: '#demo',
                        data: data,
                        toolbar: true,
                        page:{//自定义分页
                                layout:['count','prev','page','next','limit','skip','refresh'],
                                limits:[3,6,9],//分页选项
                                first:"首页",
                                last:"尾页",
                        },
                        cols: [[
                                {type: 'checkbox'},
                                {field:'userId',title:'用户ID', align:'center'},
                                {field:'account',title:'用户账号',align:'center'},
                                {field:'nickname',title:'用户名称',align:'center'},
                                {field:'used',title:'已使用',align:'center'},
                                {field:'notUsed',title:'未使用',align:'center'},
                                {title:'操作',align:'center', templet:function(data){
                                                return "<a href='JavaScript:addUseCouponUsed(\"" + data.userId +  "\");' class='operation'>赠送优惠券</a>";
                                        }},
                        ]]
                });
        }
})